/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package deatax.game.display;

import deatax.game.controller.Controller;
import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.glu.GLU;

/**
 *
 * @author pson
 */
public class CameraController implements Controller {

    private Camera cam;
    public CameraController() {
        cam = new Camera();
        cam.setPos(5, 10, 10);
        cam.setLookAt(0, 0, 0);
    }

    
    public void project(GL2 gl) {
        GLU glu = GLU.createGLU();
        gl.glMatrixMode(GL2.GL_MODELVIEW);
        gl.glLoadIdentity();
        float pos[] = cam.getPos();
        float lookAt[] = cam.getLookAt();
        //System.out.println(pos[0] + ", " + pos[1] + ", " + pos[2] + "  " + lookAt[0] + ", " + lookAt[1] + ", " + lookAt[2]);
        glu.gluLookAt(pos[0], pos[1], pos[2], lookAt[0], lookAt[1], lookAt[2], 0, 1, 0);
    }
    
    @Override
    public void update(long time) {
        
    }

    @Override
    public void draw(GL2 gl, long time) {
    }

    @Override
    public void init(GL2 gl) {
    }
    
}
